package com.xuan.collegeblog.spider.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


import com.moxi.mogublog.commons.entity.xuan.WeiBoTopicEntity;
import com.moxi.mogublog.xo.mapper.xuan.WeiBoTopicMapper;
import com.xuan.collegeblog.spider.service.WeiBoTopicService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.moxi.cloudblog.base.serviceImpl.SuperServiceImpl;

import java.util.List;


@Service
public class WeiBoTopicServiceImpl extends SuperServiceImpl<WeiBoTopicMapper, WeiBoTopicEntity> implements WeiBoTopicService {

    public List<WeiBoTopicEntity> getAllByCollegeId(Long collegeId) {
        QueryWrapper<WeiBoTopicEntity> queryWrapper = new QueryWrapper<>();
        // Page<TopicEntity> page = new Page<>(1, 10);
        if (!StringUtils.isEmpty(String.valueOf(collegeId))) {
            queryWrapper.eq("college_uid", collegeId);
        }
        queryWrapper.orderByDesc("comment_count");
        return baseMapper.selectList(queryWrapper);
    }


    @Override
    public boolean deleteByOid(String mid) {
        QueryWrapper<WeiBoTopicEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mid", mid);
        return remove(queryWrapper);
    }


}
